<header id="topbar" class="affix">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="<%= window.location.href %>">权限详情</a>
            </li>
            <li class="crumb-link">
                <a href="#console/perm/">权限管理</a>
            </li>
            <li class="crumb-trail">权限编辑</li>
        </ol>
    </div>
    <div class="pull-right">
        <a href="javascript:;" class="btn btn-primary btn-sm light fw600 ml10" id='permSave'><span class="fa fa-save"></span>保存</a>
    </div>
</header>
<section id="content">
    <div class="panel">
        <form id="perm-form" class="form-horizontal" role="form">
            <div class="form-group">
                <label class="col-md-1 control-label">ID：</label>
                <div class="col-md-2">
                    <p class="form-control-static text-muted">
                        <%= info.id %>
                    </p>
                </div>
                <label class="col-md-1 control-label">url：</label>
                <div class="col-md-3">
                    <p class="form-control-static text-muted">
                        <%= info.url %>
                    </p>
                </div>
                <label class="col-md-1 control-label">描述：</label>
                <div class="col-md-3">
                    <input type="text"  value="<%= info.desc %>" id="inputDesc" class="form-control">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-1 control-label">权限:</label>
                <div class="col-md-2">
                    <p class="form-control-static text-muted">
                        <%= info.permission == 1 ? '读' : '写' %>
                    </p>
                </div>
                <label class="col-md-1 control-label">最低角色：</label>
                <div class="col-md-4">
                    <select id="inputMinRole" class="form-control">
                        <% _.each(USER_ROLE, function(v, k){ %>
                            <option value="<%= k %>" <%= info.min_role == k ? "selected" : "" %>> <%= v %> </option>
                        <% }) %>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-1 control-label">用户权限：</label>
                <div class="col-md-4">
                    <select id="inputUserPerm" class="form-control select" multiple>
                    <%
                        _.each(PERMISSION_ROLE, function(perm){
                            _.each(perm, function(v, k){
                            user_perm_attrs = info.user_perm.split('|');
                            var mark = false;
                            for(var i = 0; i<user_perm_attrs.length; i++){
                                if(user_perm_attrs[i] == k){
                                    mark = true;
                                }
                            }
                        %>
                        <option value="<%= k %>" <%= mark ? "selected" : "" %>> <%= v %> </option>
                    <% })}) %>
                    </select>
                </div>
            </div>

        </form>
    </div>

</section>